package co.fitstart.market.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.demo2do.core.persistence.annotation.Dynamic;
import com.demo2do.core.utils.CollectionUtils;

import co.fitstart.entity.market.MarketAchievement;
import co.fitstart.entity.user.User;
import co.fitstart.market.dao.MarketAchievementDao;
import co.fitstart.market.service.MarketAchievementService;

@Service("marketAchievementService")
public class MarketAchievementServiceImpl extends DataServiceImpl<MarketAchievement> implements MarketAchievementService{

    @Dynamic
    private MarketAchievementDao marketAchievementDao;
    
    /*
     * (non-Javadoc)
     * @see co.fitstart.market.service.MarketAchievementService#list(co.fitstart.entity.user.User)
     */
    public Map<String, MarketAchievement> list(User user) {
        List<MarketAchievement> achievements = marketAchievementDao.list(user);
        return CollectionUtils.constructMapValueFromList(achievements, "type.alias");
    }

}
